package org.example.config;

import feign.Logger;
import feign.Retryer;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

@Component
public class OpenFeignConfig {
    /**
     * 请求失败后的重试配置
     * */
    @Bean
    public Retryer feignRetryer() {
/** 重试间隔100ms，最大重试间隔时间为1秒，重试次数为3次 */
        return new Retryer.Default(100, TimeUnit.SECONDS.toMillis(1L), 5);
    }
    /**设置日志级别**/
//    @Bean
//    public Logger.Level feignLoggerLevel() {
//        return Logger.Level.FULL;
//    }
    /**设置拦截器**/
//    @Bean
//    public TestOpenFeignInterceptor testOpenFeignInterceptor() {
//        return new TestOpenFeignInterceptor();
//    }
}
